package com.collect.tanzania.zhiScene.zhiCollection.zhiMember.zhiPerformance.zhiSort;

import com.collect.tanzania.zhiBean.zhiReceive.ZHIRCollecterPerformanceEntity;
import com.collect.tanzania.zhiUtils.ZHICalendarUtil;

import java.util.Comparator;

public class ZHIMemberPerformanceCompare {

    public static class ZHIMemberPerformanceCompareByAssignDateASC implements Comparator<ZHIRCollecterPerformanceEntity> {
        @Override
        public int compare(ZHIRCollecterPerformanceEntity o1, ZHIRCollecterPerformanceEntity o2) {

            long o1DateL = ZHICalendarUtil.getTimeFromDateString(o1.getAssignDate() + " 00:00:00", null);
            long o2DateL = ZHICalendarUtil.getTimeFromDateString(o2.getAssignDate() + " 00:00:00", null);

            if (o1DateL < o2DateL) {
                return -1;
            } else if (o1DateL < o2DateL) {
                return 0;
            } else {
                return 1;
            }
        }
    }

    public static class ZHIMemberPerformanceCompareByAssignDateDESC implements Comparator<ZHIRCollecterPerformanceEntity> {
        @Override
        public int compare(ZHIRCollecterPerformanceEntity o1, ZHIRCollecterPerformanceEntity o2) {

            long o1DateL = ZHICalendarUtil.getTimeFromDateString(o1.getAssignDate() + " 00:00:00", null);
            long o2DateL = ZHICalendarUtil.getTimeFromDateString(o2.getAssignDate() + " 00:00:00", null);

            return Long.compare(o2DateL, o1DateL);
        }
    }

    public static class ZHIMemberPerformanceCompareByRepayDateASC implements Comparator<ZHIRCollecterPerformanceEntity> {
        @Override
        public int compare(ZHIRCollecterPerformanceEntity o1, ZHIRCollecterPerformanceEntity o2) {

            long o1DateL = ZHICalendarUtil.getTimeFromDateString(o1.getRepayDate() + " 00:00:00", null);
            long o2DateL = ZHICalendarUtil.getTimeFromDateString(o2.getRepayDate() + " 00:00:00", null);

            if (o1DateL < o2DateL) {
                return -1;
            } else if (o1DateL < o2DateL) {
                return 0;
            } else {
                return 1;
            }
        }
    }

    public static class ZHIMemberPerformanceCompareByRepayDateDESC implements Comparator<ZHIRCollecterPerformanceEntity> {
        @Override
        public int compare(ZHIRCollecterPerformanceEntity o1, ZHIRCollecterPerformanceEntity o2) {

            long o1DateL = ZHICalendarUtil.getTimeFromDateString(o1.getRepayDate() + " 00:00:00", null);
            long o2DateL = ZHICalendarUtil.getTimeFromDateString(o2.getRepayDate() + " 00:00:00", null);

            return Long.compare(o2DateL, o1DateL);
        }
    }

    public static class ZHIMemberPerformanceCompareByAssignNumASC implements Comparator<ZHIRCollecterPerformanceEntity> {
        @Override
        public int compare(ZHIRCollecterPerformanceEntity o1, ZHIRCollecterPerformanceEntity o2) {

            int o1DateL = o1.getAssignNumFormatInt();
            int o2DateL = o2.getAssignNumFormatInt();

            if (o1DateL < o2DateL) {
                return -1;
            } else if (o1DateL < o2DateL) {
                return 0;
            } else {
                return 1;
            }
        }
    }

    public static class ZHIMemberPerformanceCompareByAssignNumDESC implements Comparator<ZHIRCollecterPerformanceEntity> {
        @Override
        public int compare(ZHIRCollecterPerformanceEntity o1, ZHIRCollecterPerformanceEntity o2) {

            int o1DateL = o1.getAssignNumFormatInt();
            int o2DateL = o2.getAssignNumFormatInt();

            return Integer.compare(o2DateL, o1DateL);
        }
    }

    public static class ZHIMemberPerformanceCompareBySettleNumASC implements Comparator<ZHIRCollecterPerformanceEntity> {
        @Override
        public int compare(ZHIRCollecterPerformanceEntity o1, ZHIRCollecterPerformanceEntity o2) {

            int o1DateL = o1.getRepayNumFormatInt();
            int o2DateL = o2.getRepayNumFormatInt();

            if (o1DateL < o2DateL) {
                return -1;
            } else if (o1DateL < o2DateL) {
                return 0;
            } else {
                return 1;
            }
        }
    }

    public static class ZHIMemberPerformanceCompareBySettleNumDESC implements Comparator<ZHIRCollecterPerformanceEntity> {
        @Override
        public int compare(ZHIRCollecterPerformanceEntity o1, ZHIRCollecterPerformanceEntity o2) {

            int o1DateL = o1.getRepayNumFormatInt();
            int o2DateL = o2.getRepayNumFormatInt();

            return Integer.compare(o2DateL, o1DateL);
        }
    }

    public static class ZHIMemberPerformanceCompareBySettleRateASC implements Comparator<ZHIRCollecterPerformanceEntity> {
        @Override
        public int compare(ZHIRCollecterPerformanceEntity o1, ZHIRCollecterPerformanceEntity o2) {

            float o1DateL = o1.getRepayRateFormatFloat();
            float o2DateL = o2.getRepayRateFormatFloat();

            if (o1DateL < o2DateL) {
                return -1;
            } else if (o1DateL < o2DateL) {
                return 0;
            } else {
                return 1;
            }
        }
    }

    public static class ZHIMemberPerformanceCompareBySettleRateDESC implements Comparator<ZHIRCollecterPerformanceEntity> {
        @Override
        public int compare(ZHIRCollecterPerformanceEntity o1, ZHIRCollecterPerformanceEntity o2) {

            float o1DateL = o1.getRepayRateFormatFloat();
            float o2DateL = o2.getRepayRateFormatFloat();

            return Float.compare(o2DateL, o1DateL);
        }
    }


    public static class ZHIMemberPerformanceCompareByBounsASC implements Comparator<ZHIRCollecterPerformanceEntity> {
        @Override
        public int compare(ZHIRCollecterPerformanceEntity o1, ZHIRCollecterPerformanceEntity o2) {

            float o1DateL = o1.getBonusFormatFloat();
            float o2DateL = o2.getBonusFormatFloat();

            if (o1DateL < o2DateL) {
                return -1;
            } else if (o1DateL < o2DateL) {
                return 0;
            } else {
                return 1;
            }
        }
    }

    public static class ZHIMemberPerformanceCompareByBounsDESC implements Comparator<ZHIRCollecterPerformanceEntity> {
        @Override
        public int compare(ZHIRCollecterPerformanceEntity o1, ZHIRCollecterPerformanceEntity o2) {

            float o1DateL = o1.getBonusFormatFloat();
            float o2DateL = o2.getBonusFormatFloat();

            return Float.compare(o2DateL, o1DateL);
        }
    }



    public static class ZHIMemberPerformanceCompareByRepayAmountASC implements Comparator<ZHIRCollecterPerformanceEntity> {
        @Override
        public int compare(ZHIRCollecterPerformanceEntity o1, ZHIRCollecterPerformanceEntity o2) {

            float o1DateL = o1.getRepayAmountFloat();
            float o2DateL = o2.getRepayAmountFloat();

            if (o1DateL < o2DateL) {
                return -1;
            } else if (o1DateL < o2DateL) {
                return 0;
            } else {
                return 1;
            }
        }
    }

    public static class ZHIMemberPerformanceCompareByRepayAmountDESC implements Comparator<ZHIRCollecterPerformanceEntity> {
        @Override
        public int compare(ZHIRCollecterPerformanceEntity o1, ZHIRCollecterPerformanceEntity o2) {

            float o1DateL = o1.getRepayAmountFloat();
            float o2DateL = o2.getRepayAmountFloat();

            return Float.compare(o2DateL, o1DateL);
        }
    }
}
